import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";

// 学术论坛项目管理列表查询
function postForumList(data) {
  return fetch({
    url: baseUrl + "/pgIntlForum/getForumList",
    method: 'post',
    data
  });
}

// 学术论坛项目管理导入
function importForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/importForum",
    method: 'post',
    data
  });
}

// 学术论坛项目下载
function downloadTemplate(data) {
  return fetch({
    url: baseUrl + "/pgForum/downloadTemplate",
    method: 'get',
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '学术论坛项目模板.xlsx', 'application/vnd.ms-excel;charset=utf-8');
  });
}

// 学术论坛项目导出
function forumExport(data) {
  return fetch({
    url: baseUrl + "/pgIntlForum/export",
    method: 'post',
    responseType: 'blob',
    data
  }).then(res => {
    UTILS.downloadFile(res, '学术论坛项目.xlsx', 'application/vnd.ms-excel;charset=utf-8');
  });
}

//学术论坛项目新增
function addForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/addForum",
    method: 'post',
    data
  });
}

// 查询学生列表
function postStudentsForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/getStudents",
    method: 'post',
    data
  });
}

// 查询学生列表
function getTeacherInfo(data) {
  return fetch({
    url: baseUrl + "/pgForum/getTeacherInfo",
    method: 'post',
    data
  });
}

// 根据学号查询学生信息
function getStudentsForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/getStudentInfo?studentId=" + data,
    method: 'get'
  });
}

// 一级学科
function getOneSubject(data) {
  return fetch({
    url: baseUrl + "/pgForum/getOneSubject",
    method: 'post',
    data
  });
}

//学术论坛项目编辑
function editForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/editForum",
    method: 'post',
    data
  });
}

//学术论坛项目删除
function delForum(data) {
  return fetch({
    url: baseUrl + "/pgForum/delForum",
    method: 'post',
    data
  });
}


//学术论坛项目详情
function getForumDetails(data) {
  return fetch({
    url: baseUrl + "/pgIntlForum/getForumDetails?id=" + data,
    method: 'get'
  });
}

// 校级项目列表查询
function listSchoolLevelProject(data) {
  return fetch({
    url: baseUrl + "/pgInterschoolLevelProject/listSchoolLevelProjects",
    method: 'post',
    data
  });
}

//  校际交流项目新增列表
function addProject(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolLevelProject/addProject`,
    method: 'Post',
    data
  });
}

//  校际交流项目查看详情
function getProject(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/get`,
    method: 'Post',
    data
  });
}
//  校际交流项目编辑
function editProject(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolLevelProject/editProject`,
    method: 'Post',
    data
  });
}
// 校际交流项目删除
function deleteProject(data) {
  return fetch({
    url: baseUrl + "/pgInterschoolLevelProject/deleteProject",
    method: 'post',
    data
  });
}

//校际交流项目状态变更（启用停用）
function changeProjectStatus(data) {
  return fetch({
    url: baseUrl + "/pgInterschoolLevelProject/changeProjectStatus",
    method: 'post',
    data
  });
}

//校际交流项目指定专家列表
function listDesignatedExperts(data) {
  return fetch({
    url: baseUrl + "/pgOverseasExchangeApply/listDesignatedExperts",
    method: 'post',
    data
  });
}

//  获取教师信息
function teacherDetail(data) {
  return fetch({
    url: `${baseUrl}/pgInterschoolProject/teacherDetail`,
    method: 'Post',
    data
  });
}
export default {
  'postForumList': postForumList,
  'importForum': importForum,
  'downloadTemplate': downloadTemplate,
  'forumExport': forumExport,
  'addForum': addForum,
  'postStudentsForum':postStudentsForum,
  'getTeacherInfo':getTeacherInfo,
  'getStudentsForum':getStudentsForum,
  'getOneSubject':getOneSubject,
  'editForum': editForum,
  'delForum': delForum,
  'getForumDetails': getForumDetails,
  'listSchoolLevelProject':listSchoolLevelProject,
  'addProject':addProject,
  'getProject':getProject,
  'editProject':editProject,
  'deleteProject':deleteProject,
  'changeProjectStatus':changeProjectStatus,
  'listDesignatedExperts':listDesignatedExperts,
  'teacherDetail':teacherDetail
};
